import $http from './http'

// 获取知识库菜单
export function getKnowledgeCaseMenu(data) {
    return $http({
        url: `/ajax.do?method=ajaxAction&managerName=docHierarchyManager`,
        method: 'post',
        data,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
    })
}

// 获取我的知识列表
export function getMyKnowledgeCaseList(data) {
    return $http({
        url: `/ajax.do?method=ajaxAction&managerName=docHierarchyManager`,
        method: 'post',
        data,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 新增知识库笔记
export function addKnowledgeCase(data) {
    return $http({
        url: `/content/content.do?method=saveOrUpdate&onlyGenerateSn=false&optType=undefined&_affairId=&_openFrom=`,
        method: 'post',
        data,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}
// 获取UUID
export function getUUID() {
    return $http({
        url: `/rest/docs/getUUID`,
        method: 'post',
        // headers: {
        //     'Content-Type': 'application/x-www-form-urlencoded'
        // }
    })
}
// 获取人员信息
export function getPersonInfo(data) {
    return $http({
        url: `/rest/docs/getCurrentUser`,
        method: 'post'
    })
}
// 确认保存知识库笔记
export function confirmSave(data, params) {
    return $http({
        url: `/doc.do?method=theNewAddVariousDocument&${params}`,
        method: 'post',
        data,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}
// 人员分享
export function sharePerson(data) {
    return $http({
        url: `/ajax.do?method=ajaxAction&managerName=docAclManager`,
        method: 'post',
        data,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 删除共享知识库内的数据
export function deleteShare(data) {
    return $http({
        url: `/rest/docs/setShardKnowledgeBase`,
        method: 'post',
        data
    })
}

// 获取审核数据
export function getAuditData(page, size) {
    return $http({
        url: `/rest/docs/getExamineList?pageNum=${page}&pageSize=${size}`,
        method: 'get'
    })
}

// 知识库加入/拒绝 接口
export function knowledgeCaseAudit(data) {
    return $http({
        url: `/rest/docs/setShardKnowledgeBase`,
        method: 'post',
        data
    })
}
// 获取共享知识库分类
export function getShareClassify(data) {
    return $http({
        url: `/ajax.do?method=ajaxAction&managerName=ztCategoryInfoManagerImpl&rnd=${Math.floor(10000 + Math.random() * 90000)}`,
        method: 'post',
        data,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 设置归类接口
export function setClassify(data) {
    return $http({
        url:`/rest/docs/setShareType`,
        method:'post',
        data
    })
}

// 删除和恢复数据接口
export function deleteAndRecover(data) {
    return $http({
        url:`/rest/docs/docBatch`,
        method:'post',
        data
    })
}

// 归类
export function classifyData(data) {
    return $http({
        url:`/rest/docs/setType?parentId=${data.parentId}&id=${data.id}`,
        method:'get',
    })
}

// 分类设置
export function setClassifyData(data) {
    return $http({
        url:`/rest/docs/addOrUpdate`,
        method:'post',
        data
    })
}
// 删除分类
export function deleteClassify(data) {
    return $http({
        url:`/rest/docs/deleteLib`,
        method:'post',
        data,
    })
}
